<?php

namespace App\Services\PolicyCommonUpload;

use Curl\StrService\StrService;

class TcCommonService
{

    /**
     * 处理同程数据
     * @param $param
     * @return void
     */
    public static function TcDataSet(&$param){

        $param['url'] = env('APP_URL').'/api/tc/commonNotify';
        $param['ext']           = StrService::uuid();

    }

    /**
     * 上传政策参数转化 同城
     * @param $param
     */
    public static function platformUpload($param) {

        $item['policyCode']                  = $param['policy_code'];
        $item['isValid']                     = $param['status'] == 1 ? 1 : 0;
        $item['avEffectiveSaleValue']        = 0;
        $item['isApplyShareFlight']          = $param['is_share'] == 'T' ? 1 : 0;
        $item['tripType']                    = 0;
        $item['airCompany']                  = $param['hs_code'];
        $item['startPort']                   = $param['depart_city_code'];
        $item['endPort']                     = $param['arrived_city_code'];
        $item['cabinCodeList']               = $param['cabin_code'];
        $item['flightNoFit']                 = 1;
        $item['flightNoList']                = $param['hs_code'].$param['flight_code'];
        $item['startDate']                   = $param['date'];
        $item['endDate']                     = $param['date'];
        $item['startSellDate']               = $param['startSellDate'];
        $item['endSellDate']                 = $param['endSellDate'];
        $item['startSaleApplyTime']          = "00:00";
        $item['endSaleApplyTime']            = "00:00";
        $item['valuationType']               = 2;
        $item['sameCabinPriceType']          = 0;
        $item['calculationLogic']            = 3;
        $item['keepMoney']                   = $param['fix_price_biding'];
        $item['sellType']                    = $param['InventoryType'] == "FIX" ? 2 : 1;
        $item['everydayInventory']           = $param['seat'];
        $item['fixedTotalPrice']             = $param['fix_price'];
        return $item;
    }
}